package com.github.ylt.protocol.http;

public final class Code {
    // 1xx
    public static final int CONTINUE = 100;
    public static final int SWITCHING_PROTOCOLS = 101;
    public static final int PROCESSING = 102;

    // 2xx
    public static final int OK = 200;
    public static final int CREATED = 201;
    public static final int ACCEPTED = 202;
    public static final int NON_AUTHORITATIVE_INFO = 203;
    public static final int NO_CONTENT = 204;
    public static final int RESET_CONTENT = 205;
    public static final int PARTIAL_CONTENT = 206;

    // 3xx
    public static final int MULTIPLE_CHOICES = 300;
    public static final int MOVED_PERMANENTLY = 301;
    public static final int FOUND = 302;
    public static final int SEE_OTHER = 303;
    public static final int NOT_MODIFIED = 304;
    public static final int USE_PROXY = 305;
    public static final int TEMPORARY_REDIRECT = 307;
    public static final int PERMANENT_REDIRECT = 308;

    // 4xx
    public static final int BAD_REQUEST = 400;
    public static final int UNAUTHORIZED = 401;
    public static final int PAYMENT_REQUIRED = 402;
    public static final int FORBIDDEN = 403;
    public static final int NOT_FOUND = 404;
    public static final int METHOD_NOT_ALLOWED = 405;
    public static final int NOT_ACCEPTABLE = 406;
    public static final int PROXY_AUTHENTICATION_REQUIRED = 407;
    public static final int REQUEST_TIMEOUT = 408;
    public static final int CONFLICT = 409;
    public static final int GONE = 410;
    public static final int LENGTH_REQUIRED = 411;
    public static final int PRECONDITION_FAILED = 412;
    public static final int PAYLOAD_TOO_LARGE = 413;
    public static final int URI_TOO_LONG = 414;
    public static final int UNSUPPORTED_MEDIA_TYPE = 415;
    public static final int RANGE_NOT_SATISFIABLE = 416;
    public static final int EXPECTATION_FAILED = 417;

    // 5xx
    public static final int INTERNAL_SERVER_ERROR = 500;
    public static final int NOT_IMPLEMENTED = 501;
    public static final int BAD_GATEWAY = 502;
    public static final int SERVICE_UNAVAILABLE = 503;
    public static final int GATEWAY_TIMEOUT = 504;
    public static final int HTTP_VERSION_NOT_SUPPORTED = 505;
    public static final int VARIANT_ALSO_NEGOTIATES = 506;
    public static final int INSUFFICIENT_STORAGE = 507;
    public static final int LOOP_DETECTED = 508;
    public static final int NOT_EXTENDED = 510;

    private Code() {
        throw new UnsupportedOperationException();
    }
    public static String getDescription(int code) {
        return switch (code) {
            case CONTINUE -> "Continue";
            case SWITCHING_PROTOCOLS -> "Switching Protocols";
            case PROCESSING -> "Processing";
            case OK -> "OK";
            case CREATED -> "Created";
            case ACCEPTED -> "Accepted";
            case NON_AUTHORITATIVE_INFO -> "Non-Authoritative Information";
            case NO_CONTENT -> "No Content";
            case RESET_CONTENT -> "Reset Content";
            case PARTIAL_CONTENT -> "Partial Content";
            case MULTIPLE_CHOICES -> "Multiple Choices";
            case MOVED_PERMANENTLY -> "Moved Permanently";
            case FOUND -> "Found";
            case SEE_OTHER -> "See Other";
            case NOT_MODIFIED -> "Not Modified";
            case USE_PROXY -> "Use Proxy";
            case TEMPORARY_REDIRECT -> "Temporary Redirect";
            case PERMANENT_REDIRECT -> "Permanent Redirect";
            case BAD_REQUEST -> "Bad Request";
            case UNAUTHORIZED -> "Unauthorized";
            case PAYMENT_REQUIRED -> "Payment Required";
            case FORBIDDEN -> "Forbidden";
            case NOT_FOUND -> "Not Found";
            case METHOD_NOT_ALLOWED -> "Method Not Allowed";
            case NOT_ACCEPTABLE -> "Not Acceptable";
            case PROXY_AUTHENTICATION_REQUIRED -> "Proxy Authentication Required";
            case REQUEST_TIMEOUT -> "Request Timeout";
            case CONFLICT -> "Conflict";
            case GONE -> "Gone";
            case LENGTH_REQUIRED -> "Length Required";
            case PRECONDITION_FAILED -> "Precondition Failed";
            case PAYLOAD_TOO_LARGE -> "Payload Too Large";
            case URI_TOO_LONG -> "URI Too Long";
            case UNSUPPORTED_MEDIA_TYPE -> "Unsupported Media Type";
            case RANGE_NOT_SATISFIABLE -> "Range Not Satisfiable";
            case EXPECTATION_FAILED -> "Expectation Failed";
            case HTTP_VERSION_NOT_SUPPORTED -> "HTTP Version Not Supported";
            case INTERNAL_SERVER_ERROR -> "Internal Server Error";
            case NOT_IMPLEMENTED -> "Not Implemented";
            case BAD_GATEWAY -> "Bad Gateway";
            case SERVICE_UNAVAILABLE -> "Service Unavailable";
            case GATEWAY_TIMEOUT -> "Gateway Timeout";
            case VARIANT_ALSO_NEGOTIATES -> "Variant Also Negotiates";
            case INSUFFICIENT_STORAGE -> "Insufficient Storage";
            case LOOP_DETECTED -> "Loop Detected";
            case NOT_EXTENDED -> "Not Extended";
            default -> "Unknown Status Code";
        };
    }
}
